import { actionCreator } from '../utils/func'
import {
  USER_LOGOUT,
  CHANGE_USER_TYPE
} from '../constants/actionType'
import User from '../models/user'

export function logout () {
  return (dispatch) => {
    User.delete()
    dispatch({
      type: USER_LOGOUT
    })
  }
}

export function changeUserType (num) {
  return actionCreator({
    type: CHANGE_USER_TYPE,
    payload: { num }
  })
}
